import request from "@/netword/request";


const fun = {};


// 分页查询所有信息
fun.getList = async (honor) => {
    const res = await request({
        url: "/a/content/honor/list",
        method: "post",
        params: {
            honorTitle: honor.honorTitle,
            pageNo: honor.pageNo,
            pageSize: honor.pageSize,
        }
    })
    return res.data;
}



//保存数据
fun.saveHonor = async (honor) => {
    const res = await request({
        url: "/a/content/honor/save",
        method: "put",
        params: {
            honorImage:honor.honorImage,
            honorTitle:honor.honorTitle,
            sort:honor.sort,
            remarks:honor.remarks,
        }
    })
    return res.data;
}



//更新数据
fun.updateHonor = async (honor) => {
    const res = await request({
        url: "/a/content/honor/update",
        method: "post",
        params: {
            id: honor.id,
            honorImage:honor.honorImage,
            honorTitle:honor.honorTitle,
            sort:honor.sort,
            remarks:honor.remarks,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/content/honor/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getHonor = async (id) => {
    const res = await request({
        url: "/a/content/honor/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}


export default fun;